//
//  GWCodeLoginViewController.m
//  ShandsMod
//
//  Created by zh_s on 2019/9/27.
//  Copyright © 2019 zh_s. All rights reserved.
//

#import "GWCodeLoginViewController.h"
#import "CreateWalletVC.h"
#import "ImportWalletVC.h"

@interface GWCodeLoginViewController ()

@end

@implementation GWCodeLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.nav.hidden = YES;
    self.view.backgroundColor = MAIN_ACTIVE_COLOR;
    
    UIImageView *topImg = [[UIImageView alloc] init];
    [self.view addSubview:topImg];
    topImg.image = IMAGE_NAME(@"icon_login_bottom");
    topImg.userInteractionEnabled = YES;
    topImg.contentMode = UIViewContentModeScaleAspectFit;
    topImg.clipsToBounds = YES;
    [topImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.view.mas_right).mas_offset(40);
        make.top.mas_equalTo(self.view.mas_top);
        make.width.mas_equalTo(578/2);
        make.height.mas_equalTo(500/2);
    }];
    UIImageView *loginImg = [[UIImageView alloc] init];
    [self.view addSubview:loginImg];
    loginImg.image = IMAGE_NAME(@"icon_login_logo");
    loginImg.userInteractionEnabled = YES;
    [loginImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.top.mas_equalTo(self.view.mas_top).mas_offset(190);
        make.width.height.mas_equalTo(110);
    }];
    UIImageView *bottomImg = [[UIImageView alloc] init];
    [self.view addSubview:bottomImg];
    bottomImg.image = IMAGE_NAME(@"icon_login_top");
    bottomImg.contentMode = UIViewContentModeScaleAspectFit;
    bottomImg.clipsToBounds = YES;
    [bottomImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view.mas_left).mas_offset(-80);
        make.top.mas_equalTo(loginImg.mas_bottom).mas_offset(HEIGHT_CONSTARIN(80));
        make.width.mas_equalTo(240);
        make.height.mas_equalTo(100);
    }];
    
    UIButton *importBtn = [BaseViewFactory buttonWithFrame:CGRectZero font:FONT_NAME(FONT_Semibold, 16) title:@"导入钱包" titleColor:MAIN_ACTIVE_COLOR backColor:UIColor.whiteColor];
    [self.view addSubview:importBtn];
    [importBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.top.mas_equalTo(loginImg.mas_bottom).mas_offset(HEIGHT_CONSTARIN(220));
        make.width.mas_equalTo(190);
        make.height.mas_equalTo(40);
    }];
    [importBtn addTarget:self action:@selector(importBtnClcik) forControlEvents:UIControlEventTouchUpInside];
    GWRadius(importBtn, 20);
    
    UIButton *creatWalletBtn = [BaseViewFactory buttonWithFrame:CGRectZero font:FONT_NAME(FONT_Semibold, 16) title:@"创建钱包" titleColor:MAIN_ACTIVE_COLOR backColor:UIColor.whiteColor];
    [self.view addSubview:creatWalletBtn];
    [creatWalletBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.top.mas_equalTo(importBtn.mas_bottom).mas_offset(21);
        make.width.mas_equalTo(190);
        make.height.mas_equalTo(40);
    }];
    GWRadius(creatWalletBtn, 20);
    [creatWalletBtn addTarget:self action:@selector(creatWalletBtnClcik) forControlEvents:UIControlEventTouchUpInside];
    
}

- (void)importBtnClcik {
    
    ImportWalletVC *vc = [[ImportWalletVC alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)creatWalletBtnClcik {
    CreateWalletVC *vc = [[CreateWalletVC alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

@end
